<?php

namespace Admin\Controller;

use Think\Model;
/**
 * Description of SpOrderController
 *
 * @author Myron
 */
class SpOrderController extends AdminController{
     /**
     * 展示销售单据
     * @author 曹梦龙 <138888611@qq.com>
     */
     public function index($b_date='',$e_date=''){ 
        $shopId=I('shopId');
        if($shopId>-1){
            $map['shopId'] =$shopId;
            $this->assign('shopId', $shopId);
        };
        if($b_date && $e_date){
            $b=strtotime($b_date);
            $e=strtotime($e_date);           
            $map['createat']=array('between',$b.','.$e);
        }
        $name = I('name');
        $map['name'] = array('like', '%' . (string) $name . '%');
        $shoplist = M('sp_shops')->where(array('status' => 1))->select();
        $this->assign('shoplist', $shoplist);
        $list = $this->lists('sp_order', $map);
        int_to_string($list);
        $this->assign('_list', $list);
        $this->meta_title = '标题';
        $this->display();
     }
     
     /**
      * 销售订单详情
      */
     public function detail($id=''){
        $map['orderId']=$id;
        $list = $this->lists('sp_orderproduct', $map);
        int_to_string($list);
        $this->assign('_list', $list);  
        $this->display();
     }
}
